import {get,post} from "../untils/db"


Page({
  data:{
    token:"",
    dialogShow: false,
    buttons: [{text: '取消'}, {text: '确定'}],
    msg:""
  },
  onLoad(){
  let res= wx.getStorageSync('users')
  this.setData({
    msg:res
  })
  },
  async tapDialogButton(e) {
    console.log(e.detail.index);
    let token=wx.getStorageSync('login')
    if(e.detail.index==1){
    let res=await post("/api/logout",{},token)
    console.log(res);
    if(res.data.code==200){
      wx.navigateTo({
        url: '../begin/login/login',
      })

      wx.showToast({
        title: '退出成功',
      })
    }
    }
    this.setData({
        dialogShow: false,
        showOneButtonDialog: false
    })
},
  personal(){
    wx.navigateTo({
      url: '../personal/personal',
    })
  },
  record(){
  wx.navigateTo({
    url: '../point/record/record',
  })
  },
  shenhe(){
    wx.navigateTo({
      url: '../shenhe/examine/examine',
    })
  },
  apply(){
    wx.navigateTo({
      url: '../apply/apply/apply',
    })
  },
  renwuing(){
    wx.navigateTo({
      url: '../renwuing/main/apply',
    })
  },
  exit(){
  this.setData({
    dialogShow:true
  })
  }
})